package com.ylxl.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ylxl.common.utils.StringUtils;
import com.ylxl.entity.Cities;
import com.ylxl.entity.request.QueryChina;
import com.ylxl.mapper.CitiesMapper;
import com.ylxl.service.ICityesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户 业务层处理
 *
 */
@Service
public class CitiesServiceImpl extends ServiceImpl<CitiesMapper, Cities>  implements ICityesService {
    private static final Logger log = LoggerFactory.getLogger(CitiesServiceImpl.class);

    @Autowired
    private CitiesMapper citiesMapper;


    @Override
    public List<Cities> selectList(QueryChina queryChina) {
        LambdaQueryWrapper<Cities> areasLambdaQueryWrapper = new LambdaQueryWrapper<>();
        areasLambdaQueryWrapper.eq(StringUtils.isNotEmpty(queryChina.getProvinceCode()),Cities::getProvinceCode,queryChina.getProvinceCode())
                .eq(StringUtils.isNotEmpty(queryChina.getCityCode()),Cities::getCityCode,queryChina.getCityCode());
        return citiesMapper.selectList(areasLambdaQueryWrapper);
    }
}
